# 抽象工厂模式
class IUser:
    def get_user(self):
        pass

    def insert_user(self):
        pass


class IDepartment:
    def get_department(self):
        pass

    def insert_department(self):
        pass


class CAccessUser(IUser):
    def get_user(self):
        print("Access getuser")

    def insert_user(self):
        print("Access InsertUser")


class CAccessDepartment(IDepartment):
    def get_department(self):
        print("Access GetDepartment")

    def insert_department(self):
        print("Access insertDepartment")


class CSqlUser(IUser):
    def get_user(self):
        print("Sql Get User")

    def insert_user(self):
        print("Sql insert User")


class CSqlDepartment(IDepartment):
    def get_department(self):
        print("Sql get department")

    def insert_department(self):
        print("Sql insert department")


class IFcatory:
    def create_user(self):
        pass

    def create_department(self):
        pass


class AccessFactory(IFcatory):
    def create_user(self):
        temp = CAccessUser()
        return temp

    def create_department(self):
        temp = CAccessDepartment()
        return temp


class SqlFactory(IFcatory):
    def create_user(self):
        temp = CSqlUser()
        return temp

    def create_department(self):
        temp = CSqlDepartment()
        return temp


if __name__ == "__main__":
    factory = SqlFactory()
    user = factory.create_user()
    depart = factory.create_department()
    user.get_user()
    depart.get_department()
